<?php

/**
 * This is the model class for table "luastanahsawahirigasi".
 *
 * The followings are the available columns in table 'luastanahsawahirigasi':
 * @property integer $ltsi_id
 * @property integer $id_kecamatan
 * @property integer $irigasiteknis
 * @property integer $irigasisemiteknis
 * @property integer $irigasisederhana
 * @property integer $irigasidesa
 * @property integer $tadahhujan
 * @property integer $pasangsurut
 * @property integer $lebak
 * @property integer $jumlah
 * @property integer $tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $idKecamatan
 */
class Luastanahsawahirigasi extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Luastanahsawahirigasi the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'luastanahsawahirigasi';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('id_kecamatan, irigasiteknis, irigasisemiteknis, irigasisederhana, irigasidesa, tadahhujan, pasangsurut, lebak, jumlah, tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ltsi_id, id_kecamatan, irigasiteknis, irigasisemiteknis, irigasisederhana, irigasidesa, tadahhujan, pasangsurut, lebak, jumlah, tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'idKecamatan' => array(self::BELONGS_TO, 'Kecamatan', 'id_kecamatan'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ltsi_id' => 'Ltsi',
			'id_kecamatan' => 'Id Kecamatan',
			'irigasiteknis' => 'Irigasi Teknis',
			'irigasisemiteknis' => 'Irigasi Semi Teknis',
			'irigasisederhana' => 'Irigasi Sederhana',
			'irigasidesa' => 'Irigasi Desa',
			'tadahhujan' => 'Tadah Hujan',
			'pasangsurut' => 'Pasang Surut',
			'lebak' => 'Lebak',
			'jumlah' => 'Jumlah',
			'tahun' => 'Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ltsi_id',$this->ltsi_id);
		$criteria->compare('id_kecamatan',$this->id_kecamatan);
		$criteria->compare('irigasiteknis',$this->irigasiteknis);
		$criteria->compare('irigasisemiteknis',$this->irigasisemiteknis);
		$criteria->compare('irigasisederhana',$this->irigasisederhana);
		$criteria->compare('irigasidesa',$this->irigasidesa);
		$criteria->compare('tadahhujan',$this->tadahhujan);
		$criteria->compare('pasangsurut',$this->pasangsurut);
		$criteria->compare('lebak',$this->lebak);
		$criteria->compare('jumlah',$this->jumlah);
		$criteria->compare('tahun',$this->tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}